/**
 * 
 * @param {string} key 
 * @param {string} val 
 * @param {number} s 
 */

// 储存cookie数据
function setcookie(key,val,s){
if(typeof val ==="object") 
    val = JSON.stringify(val);
    const d = new Date();
    d.setTime(d.getTime() - 1000*60*60*8+1000*1*s);
    document.cookie = `${key}=${val};expires=${d}`
    
}
// 移除cookie数据
function removecookie(key){
    setcookie(key,null,-1);
}

// 增加cookie数据

/**
 * 
 * @param {string} key 
 * @returns 
 */

function getcookie(key){
    let arr = document.cookie.split("; ");
    for(let i = 0;i<arr.length;i++){
    let temp = arr[i].split("==")
    if(temp[0] === key){
        return temp[1]
    }
}

}